package com.qiantu.phone.ui.shotview;

import android.content.Context;

import com.qiantu.api.entity.DeviceBean;
import com.qiantu.phone.ui.fragment.device.BFCurtainFragment;
import com.qiantu.phone.ui.fragment.device.BlindCurtainFragment;
import com.qiantu.phone.ui.fragment.device.UniversalDeviceFragment;
import com.qiantu.phone.ui.uiutil.DeviceType;

/**
 * @ClassName ShutViewManager
 * @Description TODO
 * @Author ShiJunqiang
 * @Date 2021/12/9 22:55
 * @Version 1.0
 */
public class ShotViewManager {
    public static BaseDeviceActView getDeviceView(Context context, DeviceBean deviceBean) {
        if (deviceBean.getDeviceType().equals(DeviceType.BREAKER_LIGHT.stringType)) {
            return new DeviceLightShutView(context);
        } else if (deviceBean.getDeviceType().equals(DeviceType.ADJUST_LIGHT.stringType)) {
            return new DimmingLightShotView(context);
        } else if (deviceBean.getDeviceType().equals(DeviceType.TCT_DL.stringType) || deviceBean.getDeviceType().equals(DeviceType.ADJUST_LCT.stringType)) {
            return new ColorTemperatureLightShotView(context, deviceBean.getDeviceType());
        } else if (deviceBean.getDeviceType().equals(DeviceType.ADJUST_COLOR.stringType)) {
            return new ColorLightShotView(context, deviceBean.getDeviceType());
        } else if (deviceBean.getDeviceType().equals(DeviceType.WINDOW_CURTAINS.stringType) || deviceBean.getDeviceType().equals("oc_windowcurtains")) {
            return new KHCurtainShotView(context);
        } else if (deviceBean.getDeviceType().equals("blind_windowcurtains")) {
            return new BlindCurtainShotView(context);
        } else if (deviceBean.getDeviceType().equals(DeviceType.ROLLER_SHUTTER.stringType)) {
            return new RollerShutterShotView(context);
        } else if (deviceBean.getDeviceType().equals(DeviceType.BOFU_CURTAINS.stringType) || deviceBean.getDeviceType().equals("dream_windowcurtains")) {
            return new BFCurtainShotView(context);
        } else if (deviceBean.getType().equals("airconditioner")) {
            if(deviceBean.getDeviceType().equals("universal_ac")){
                UniversalAirShotView universalShotView = new UniversalAirShotView(context);
                universalShotView.setDevice(deviceBean);
                return universalShotView;
            }else{
                return new AirConditionerShotView(context, deviceBean.getType(), deviceBean.getDeviceType());
            }
        } else if (deviceBean.getDeviceType().equals(DeviceType.ADJUST_COLOR.stringType)) {
            return new DimmingLightShotView(context);
        } else if (deviceBean.getType().equals("freshair")) {
            if(deviceBean.getDeviceType().equals("universal_freshair")){
                UniversalShotView universalShotView = new UniversalShotView(context);
                universalShotView.setDevice(deviceBean);
                return universalShotView;
            }else{
                return new FreshAirShotView(context, deviceBean.getType(), deviceBean.getDeviceType());
            }
        } else if (deviceBean.getType().equals("floorheating")) {
            return new FloorHeatingShotView(context, deviceBean.getType(), deviceBean.getDeviceType());
        } else if (deviceBean.getDeviceType().equals(DeviceType.WIRELESS_315_KEY_1.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.WIRELESS_433_KEY_1.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.INFRARED_KEY_1.stringType)) {
            return new OnKeyShotView(context, deviceBean.getDeviceType());
        } else if (deviceBean.getDeviceType().equals(DeviceType.WIRELESS_315_KEY_2.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.WIRELESS_433_KEY_2.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.INFRARED_KEY_2.stringType)) {
            return new TwoKeyShotView(context, deviceBean.getDeviceType());
        } else if (deviceBean.getDeviceType().equals(DeviceType.WIRELESS_315_KEY_3.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.WIRELESS_433_KEY_3.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.INFRARED_KEY_3.stringType)) {
            ThreeKeyShotView threeKeyShotView = new ThreeKeyShotView(context, deviceBean.getDeviceType());
            threeKeyShotView.setDevice(deviceBean);
            return threeKeyShotView;
        } else if (deviceBean.getDeviceType().equals(DeviceType.WIRELESS_315_KEY_7.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.WIRELESS_433_KEY_7.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.INFRARED_KEY_7.stringType)) {
            return new SevenKeyShotView(context, deviceBean.getDeviceType());
        } else if (deviceBean.getDeviceType().equals(DeviceType.WIRELESS_315_KEY_9.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.WIRELESS_433_KEY_9.stringType)
                || deviceBean.getDeviceType().equals(DeviceType.INFRARED_KEY_9.stringType)) {
            TenKeyShotView tenKeyShotView = new TenKeyShotView(context, deviceBean.getDeviceType());
            tenKeyShotView.setDevice(deviceBean);
            return tenKeyShotView;
        }else if(deviceBean.getDeviceType().equals(DeviceType.XINYUE_MUSIC.stringType)){
            MusicShotView musicShotView = new MusicShotView(context);
            musicShotView.setDevice(deviceBean);
            return musicShotView;
        }else if (deviceBean.getDeviceType().equals(DeviceType.UNIVERSAL_SEQUENCER.stringType) || deviceBean.getDeviceType().equals(DeviceType.UNIVERSAL_PROJECTOR.stringType) || deviceBean.getDeviceType().equals(DeviceType.UNIVERSAL_PLAYER.stringType) || deviceBean.getDeviceType().equals(DeviceType.UNIVERSAL_PA.stringType)){
            UniversalShotView universalShotView = new UniversalShotView(context);
            universalShotView.setDevice(deviceBean);
            return universalShotView;
        }
        return new NoSuchShotView(context);
    }
}
